﻿<cfscript>
/** 
* DataBase Frameworks - Sequence
* 
* @hint "DataBase Frameworks - Sequence - QuestionVote" 
*/ 

component 
	displayname="public.service.db.senate.sequence.ProgramSchema" 
	output=false 
	accessors=true 
	{

	property type="string" name="SubjectID" hint="专业号";
	property type="string" name="Grade" hint="年级编号";
	property type="string" name="SubjectDirection" hint="专业方向号";
	property type="string" name="CourseID" hint="课程号";
	
	/**
	* @hint "初始化对象"
	*/
	public function init() output=false {
		return this;
	}
	
	/**
	* @hint "自定义主键规则"
	*/
	public string function getID() output=false {
		
		var nextID = getGrade() & left(getSubjectID(), 5) & getSubjectDirection() & getCourseID();

		/* 
			主键生成规则 
			
			年级编号+ 5位专业号 +专业方向号 + 课程号

			Unique: GRADE，sbj_d, sbj_direction, cid
		*/
		return nextID;
	}

}

</cfscript>